import { createApp } from 'vue'
import pinia from './stores'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import './styles/index.scss'
import ElSvg from './components/SvgIcon/ElSvg'
import './permission'
import Category  from '@/components/Category/index.vue';
import {useUserInfoStore} from '@/stores/userInfo';
import {vueECharts} from '@/plugins/echarts';
import "@/mockServer/index";

const userInfoStore = useUserInfoStore(pinia)

const app = createApp(App);

app.directive('test',(el,binding)=> {
  if(!userInfoStore.userInfo.buttons.includes(binding.value)){
    el.remove()
  }
})

//全局注册三级联动组件
app.component("Category",Category)

ElSvg(app)

app.use(pinia)
  .use(router)
  .use(vueECharts)
  .use(ElementPlus, {
    locale: zhCn,
  })
  .mount('#app')
